<?php
class admin_model extends CI_Model{
	
	function addnew($title, $summary)
	{
		$query_str = "INSERT INTO summary (summary_title, summary_content) VALUES (?, ?)";
		
		$this->db->query($query_str, array($title, $summary));
		
	}	
	
	function getSummary(){
		//get ideas with most views
		$this->db->limit(3);
		$this->db->order_by("summary_id", "desc");
		
		return $this->db->get("summary")->result();
		
	function getSummaryById($id) {
		/*
		 * This function get idea's content from the database based on id
		 */
		$sumIdeas = $this -> db -> get_where('summary', array('summary_id' => $id)) -> result();
		if (!$sumIdeas) {
			//error 404
			show_404(base_url());
		} else {
			//return idea
			return $sumIdeas[0];
		}
	}	
	
	
	}
}